package com.hudson.codec;

import com.hudson.codec.hudson.HudsonMQCodec4Binary;
import com.hudson.codec.json.HudsonMQCodec4Json;
import com.hudson.codec.proto.HudsonMQCodec4ProtoBuf;
import io.netty.handler.codec.ByteToMessageCodec;

public class MessageCodecFactory {

    public static ByteToMessageCodec getCodec(int serializableMethod){
        return switch (serializableMethod) {
            case 0 -> new HudsonMQCodec4Binary();
            case 1 -> new HudsonMQCodec4Json();
            case 2 -> new HudsonMQCodec4ProtoBuf();
            default -> throw new RuntimeException("无法找到正确的序列化器");
        };
    }
}
